<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>처 방 전</title>
<!-- <link rel="stylesheet" href="resources/css/office/cheobangjeon.css"> -->
<script src="resources/js/jquery-1.6.4.min.js"></script>
<script src="resources/js/jquery.PrintArea.js_4.js"></script>
<script src="resources/js/jquery.printElement.js"></script>
</head>
<body>
<div>
	<img alt="" class="printBtn" style="width:60px;height:60px; margin-top: 13px;" src="resources/images/officeword[black].png" id="btnExcel" accesskey="o">
	<img alt="" src="resources/images/print-icon.jpg" class="printBtn" id="printBtn" accesskey="p">
	<a href="cheobang.do"><img alt="" src="resources/images/xbutton.png" class="xBtn" id="close" ></a>
</div>

<div class="cheobangjeon" id="cheobangjeon">
<div class="c1">[환자 보관용]</div>
<table id="cheobangjeontb">
<tr><th colspan="7" class="C_title">처방전</th></tr>
<tr class="c_title2"><td colspan="7" id='excelname'>등록번호[ ${cheobangall.cheobang_id } ] 가입자[ ${patient.name} ]</td></tr>
<tr><td colspan="7" class="c_select"> 보험유형  [&nbsp;&nbsp;<font color="black">${cheobangall.TYPE }</font>&nbsp;&nbsp;]　　① 국민보험　　　　② 산재보험　　　　③ 자동차보험　　　　④ 기타(　　　　　　)</td></tr>
<tr><th>교부년월일 및 번호</th><td colspan="2">${cheobangall.JUPSOO_DATE} </td>
<td rowspan="4" id='t-color'>의료기관</td><td id='t-color'>명칭</td>
<td colspan="2" >메디컬 탑 병원</td></tr>
<tr><th rowspan="3" >환자</th><td id="t-color" class='name'>성명</td><td>${patient.name}</td>
<td id='t-color'>전화번호</td><td colspan="2"> 011- 253 - 4718</td></tr>
<tr><td rowspan="2" id='t-color' class="jumin">주민등록번호</td><td rowspan="2">${patient.jumin1} - ${patient.jumin2 }</td>
<td id='t-color'>팩스번호</td><td colspan="2"> 031-113132</td></tr>
<tr><td id='t-color'>e-mail주소</td><td colspan="2">medicaltop@naver.com</td></tr>
<tr><th rowspan="2">질병 명 및 질병 분류 기호</th><td rowspan="2" colspan="2"><c:forEach items="${diseaselist }" var="disease">${disease.disease_id}<br></c:forEach></td>
<td rowspan="2" id='t-color'>처방의료인의 성명</td><td rowspan="2" class="do">&nbsp;${cheobangall.DOCTOR_NAME }  <img id='i' src="resources/images/cheobangjeon.png"></td>
<td id='t-color'>면허종별</td><td>의사</td></tr>
<tr><td id='t-color'>면허번호</td><td>${cheobangall.DOCTOR_ID }</td></tr>
<tr><td colspan="7" id="explain">※ 환자의 요구가 있을 때에는 질병분류 기호를 기재하지 않습니다</td></tr>
<tr id="mediinfo"><th colspan="3" id="m1">처방의약품명칭</th><th id="one">1회 투약량</th><th id="two">개수</th><th id="three">단위</th><th id="four">용법</th></tr>
<tr class="meditr"><td colspan="7" style="height:300px;width:100%;"><div style="height:300px;"><table id="small">
<c:forEach items="${ mediclist}" var="medic">
<tr id="md"><td class="mname">${medic.name }</td><td class="a1">1</td><td class="amount">${medic.quantity }</td><td id="unit">${medic.unit }</td><td id="dose_name">${medic.dose_name }</td></tr>
</c:forEach>
</table></div></td></tr>
<tr id="mediinfo2"><th colspan="5" >주사제처방 내역 (원내 조제 <input type="radio" checked name="rd">, 원외 처방<input type="radio" name="rd">)</th><th colspan="2">조제시 참고사항</th></tr>
<tr><td colspan="5">1</td><td colspan="2">5</td></tr>
<tr id="useinfo"><th>사용기간</th><td colspan="3">교부일로부터 (　3　) 일간</td><td colspan="3" class="">사용기간내에 약국에 제출하여야 합니다.</td></tr>
<tr id="mediinfo2"><th colspan="7">의약품 조제 내역</th></tr>
<tr><td rowspan="4">조제내역</td><td>조제기관의명칭</td><td colspan="3">3</td><td colspan="2">처방의 변경·수정·확인 대체시 그 내용 등</td></tr>
<tr><td>조제약사</td><td>성명</td><td colspan="2">　　　　　　(서명또는 날인)</td><td colspan="2">6</td></tr>
<tr><td>조제량(조제일수)</td><td colspan="3">3</td><td colspan="2">6</td></tr>
<tr><td>조제년월</td><td colspan="3">3</td><td colspan="2">6</td></tr>
</table>

</div>

<script type="text/javascript">
	$(document).ready(function(){
		$("#printBtn").click(function(){
			$("#cheobangjeontb").printElement({
				printMode: 'popup', 
				pageTitle:'cheobangjeon.jsp', 
				overrideElementCSS:['<c:url value="resources/css/office/cheobangjeon.css"/>', 
				                    { href:'<c:url value="resources/css/office/cheobangjeon.css"/>',media:'print' }],
				leaveOpen:false 
			});
		});
	});

	
	//파일 이름 지정해서 엑셀 저장	
	$("#btnExcel").live("click", function () {
        var a = document.createElement('a');
        var data_type = 'data:application/vnd.ms-excel';
        var table_html = encodeURIComponent($("#cheobangjeontb").html());
        a.href = data_type + ', ' + table_html;
        a.download = '${patient.name}[${cheobangall.JUPSOO_DATE}].xls';
        
        a.click();
        e.preventDefault();
	});

</script>

</body>
</html>
